package com.webguard.outlierdetection.pojo;



import com.fasterxml.jackson.annotation.JsonIgnore;

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {
    //controller接受User类转为参数时必须符合下列直接的规则，要不然传参错误
    @NotNull
    private Integer id;//主键ID
    private String username;//用户名
    @JsonIgnore//让springMVC把当前对象转为json字符串时，忽略password，防止将密码发送回去
    //加了这个前端为注册传递的数据有password字段时不能以raw，json形式传递会被忽略
    private String password;//密码


    @NotEmpty
    @Email
    private String email;//邮箱

    private LocalDateTime createTime;//创建时间
    private LocalDateTime updateTime;//更新时间

    @NotNull
    private boolean isAdmin = false;
}
